from pydantic import BaseModel
from typing import List, Optional, Any

class FormItemBase(BaseModel):
    title: str
    type: str
    required: bool
    description: Optional[str] = None
    options: Optional[List[str]] = None

class FormCreate(BaseModel):
    activity_id: int
    form_items: List[FormItemBase]

class Form(FormCreate):
    id: int
    
    class Config:
        from_attributes = True

class FormAnswer(BaseModel):
    form_item_id: int
    answer: Any

class FormSubmissionCreate(BaseModel):
    activity_id: int
    answers: List[FormAnswer]

class FormSubmission(FormSubmissionCreate):
    id: int
    user_id: int
    form_id: int
    
    class Config:
        from_attributes = True 